<!-- <template>
<div style="height: 100vh">

    <div style="width: 500px;height: 300px ;background-color:blanchedalmond ;border-radius: 10px;margin: 150px auto;padding: 50px">

    <div style="margin: 30px;text-align:center;font-size:30px;font-weight: bold;color: dodgerblue">登录 </div>

        <el-form :model="admin" ref="loginform">
            <el-form-item prop="username">
                <el-input placeholder="请输入账号" size="default" v-model="admin.username"></el-input>
            </el-form-item>

            <el-form-item prop="password">
                <el-input placeholder="请输入密码" size="default" v-model="admin.password" type="password" show-password></el-input>
            </el-form-item>

            <el-form-item>
                <el-button style="width: 100%" size="default" @click="login" >登入   </el-button>
            </el-form-item>

        </el-form>

    </div>
</div>
</template>

<script>
    import axios from '@/utils/request';
    // import cookie from 'js-cookie'

    export default {
        name: "MyLogin",
        data(){
            return{
                admin:{}
            }
        },
        methods:{
            login(){
                axios.post('http://localhost:3000/posts',JSON.stringify(this.admin)).then(res=>{
                    console.log(res);
                    if (res.code===200)
                    {
                        this.$notify.success("登入成功")
                        if (res.data!==null)
                        {
                            // cookie.set('user',JSON.stringify(res.data))
                        }
                        this.$router.push('/')
                    }else this.$notify.error(res.msg)
                })
                axios.get('http://localhost:3000/get').then(res=>{
                    console.log(res);
                if (res.code==200) {
                    // this.$notify.success("删除成功")
                    // this.load()
                    console.log(res);
                }
            })
            }
        }
    }
</script>
 -->
